//
//  DatabaseCMDList.h
//  dataGathering
//
//  Created by apple on 14/12/31.
//  Copyright (c) 2014年 shuili. All rights reserved.
//

#ifndef dataGathering_DatabaseCMDList_h
#define dataGathering_DatabaseCMDList_h

#define DATABASECMD_WORKSETLIST_CREATE           @"create table workset_table(id String primary key,name String, user String, time_create String, time_update String, location_name String, description String, isFinished bool, isAutoSync bool, coordinate String, thumb string, isLocationTracked bool, isOnlineLayerDIsplayed bool, isDeleted bool)"

#define DATABASECMD_LAYERINFOTABLE_CREATE          @"create table layer_info_table(name String primary key, type String, renderer String, version String)"

#define DATABASECMD_USERINFOTABLE_CREATE         @"create table user_info_table(name String primary key, pwd String, realname String, department String)"

#define DATABASECMD_NEWCOLLECTEDDATA_DATABASE_CREATE         @"create table '%@'(OBJECTID String primary key,id String, name String, description String, time_create String, time_update String, user_name String, user_realname String)"

#define DATABASECMD_NEWCOLLECTEDDATA_DATABASE_ADDGEOMETRYCOLUMN         @"SELECT AddGeometryColumn('%@','geometry',4490,'GEOMETRY')"

#define DATABASECMD_NEWCOLLECTEDDATA_MEDIA_DATABASE_CREATE        @"create table '%@_media'(OBJECTID String, media string primary key, type String)"

#define DATABASECMD_COLLECTEDDATA_IMAGEURLLIST_CREATE           @"CREATE TABLE collecteddataimageurllist (WorksetName text, Dataname text, Image blob)"

#define DATABASECMD_INSERT_NEW_WORKSET           @"INSERT INTO workset_table (id, name, user, thumb, time_create, time_update, location_name, description, coordinate, isAutoSync, isFinished, isLocationTracked, isOnlineLayerDisplayed) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"

#define DATABASECMD_INSERT_NEW_COLLECTEDDATA          @"INSERT INTO '%@' (OBJECTID, id, name, description, time_create, time_update, user_name, user_realname, geometry) VALUES (?,?,?,?,?,?,?,?,GeomFromText('?',4490))"

#define DATABASECMD_GET_ALL_WORKSET          @"SELECT * FROM workset_table"

#define DATABASECMD_GET_COLLECTEDDATALIST         @"SELECT WorksetName, Dataname, DataDescription, CreatedUserName, CreatedRealName,CreatedTime,Geometry,Type,MainType,IdNumber FROM collecteddatalist WHERE WorksetName = ?"

#define DATABASECMD_GET_IMAGELIST          @"SELECT Image FROM collecteddataimageurllist WHERE Dataname = ?"

/*
#define DATABASECMD_INSERT_NEW_COLLECTEDDATA        @"INSERT INTO collecteddatalist (WorksetName, Dataname, DataDescription, CreatedUserName, CreatedRealName, CreatedTime, Geometry, Type, MainType, IdNumber) VALUES (?,?,?,?,?,?,?,?,?,?)"
 */

#endif
